<template>
  <tr>
    <td><input type="checkbox" v-model="data.checked"/></td>
    <td>{{data.name}}</td>
    <td>{{data.price}}</td>
    <td>
      <button @click="jj">-</button>
      {{data.num}}
      <button @click="data.num++">+</button>
    </td>
    <td>{{data.num*data.price}}</td>
    <td><button @click="onDel">删除</button></td>
  </tr>
</template>

<script>
export default {
  data () {
    return {

    }
  },
  props: ['data'],
  created () {

  },

  methods: {
    jj () {
      if (this.data.num >= 2) {
        this.data.num--
      }
    },
    onDel () {
      this.$emit('onDel')
    }
  }
}
</script>

<style scoped lang='less'>

</style>
